import request from '@/utils/request'

const api = {
  roleAdd: '/comdesk_role/add',
  roleUpdate: '/comdesk_role/update',
  roleDelete: '/comdesk_role/delete',
  roleFind: '/comdesk_role/find',
  roleFindByUser: '/comdesk_role/find_byUser',
  findpermbyusercode: '/comdesk_permission/findpermbyusercode',
}
export function findpermbyusercode(data) {
  return request({
    url: api.findpermbyusercode,
    method: 'post',
    data,
  })
}
export function roleFind(params) {
  return request({
    url: api.roleFind,
    method: 'get',
    params,
  })
}
export function roleFindByUser(params) {
  return request({
    url: api.roleFindByUser,
    method: 'get',
    params,
  })
}
export function roleAdd(data) {
  return request({
    url: api.roleAdd,
    method: 'post',
    data,
  })
}

export function roleUpdate(data) {
  return request({
    url: api.roleUpdate,
    method: 'post',
    data,
  })
}

export function roleDelete(pkRole) {
  return request({
    url: `${api.roleDelete}?plRole=${pkRole}`,
    method: 'get',
  })
}
